package com.ruoyi.erp.service.impl;

import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.erp.domain.*;
import com.ruoyi.erp.mapper.CustomDictMapper;
import com.ruoyi.erp.service.*;
import com.ruoyi.system.domain.Customer;

import com.ruoyi.system.service.ICustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.List;

@Service("customDictService")
public class CustomDictServiceImpl implements ICustomDictService {

    @Autowired
    private CustomDictMapper customDictMapper;
    @Autowired
    private ICustomerService customerService;
    @Autowired
    private IBusinessUnitService businessUnitService;
    @Autowired
    private IStaffProfileService staffProfileService;
    @Autowired
    private IHolidayConfigTypeService holidayConfigTypeService;
    @Autowired
    private IProjectService projectService;
    @Autowired
    private IOpportunityService opportunityService;

    @Autowired
    private IBankAccountService bankAccountService;
    @Autowired
    private IBusinessUnitDepartmentService businessUnitDepartmentService;

    @Override
    public List<DictSysUser> selectUserList() {
        return customDictMapper.selectUserList(new SysUser());
    }

    @Override
    public List<Customer> selectDictCustomer() {
        Customer search = new Customer();
        return customerService.selectCustomerList(search);
    }

    @Override
    public List<BusinessUnit> selectDictBusinessUnit() {
        return businessUnitService.selectBusinessUnitList(new BusinessUnit());
    }

    @Override
    public List<StaffProfile> selectDictOnboardStaff() {
        StaffProfile search = new StaffProfile();
        search.setOnboardStatus(1);
        return staffProfileService.selectStaffProfileList(search);
    }

    @Override
    public List<HolidayConfigType> selectDictHolidayConfigType()
    {
        return holidayConfigTypeService.selectHolidayConfigTypeList(null);
    }

    @Override
    public List<Project> selectDictStaffingProject() {
        Project search = new Project();
        search.setProjectType("staffing");
        return projectService.selectProjectList(search);
    }

    @Override
    public List<Project> selectDictAllProject() {
        return projectService.selectProjectList(new Project());
    }

    @Override
    public List<Project> selectDictNotStaffingProject() {
        return projectService.selectNotStaffingProjectList();
    }

    @Override
    public List<BankAccount> selectDictBanks() {
        BankAccount search = new BankAccount();
        search.setIsFlow(1);
        return bankAccountService.selectBankAccountList(search);
    }

    @Override
    public List<Opportunity> selectDictOpportunity() {
        Opportunity opportunity = new Opportunity();
        opportunity.setStatus("working");
        return opportunityService.selectOpportunityList(opportunity);
    }

    @Override
    public List<BusinessUnit> selectDictBusinessUnitWithDepartments() {
        BusinessUnit search = new BusinessUnit();
        search.getParams().put("disabled",'N');
        List<BusinessUnit> result = businessUnitService.selectBusinessUnitList(search);
        return result;
    }

    @Override
    public List<BusinessUnitDepartment> selectDictBusinessUnitDepartments() {
        return businessUnitDepartmentService.selectBusinessUnitDepartmentList(null);
    }
}
